package getscores;

import java.util.Scanner;

public class GetScores {
    GetScores(){};
    public double[] GetScores( ){

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入参与评分的老师数量：");
        int number=sc.nextInt();
        double[] scores =new double[number];
        for(int i=0;i<scores.length;i++){
            System.out.println("请依次输入评分成绩：");
            scores[i]=sc.nextInt();
        }
     return scores;
    }
    public double caulculationScores(double[] scores){
        int key1=0;
        double temp=scores[0];
        for(int i=1;i<scores.length;i++){
            if(temp<scores[i]){
                temp=scores[i];
                key1=i;
            }
            else{key1=0;}
        }
        scores[key1]=0;
        double temp1=0.0;
        for(int i=0;i<scores.length;i++){
            if(key1!=i) {
                temp1 = scores[i];
                break;
            }
        }
        int key2 = 0;
        for(int i=0;i<scores.length;i++){
            if(i!=key1){
                if(temp1>=scores[i]){
                    temp1=scores[i];
                    key2=i;
                }

            }
            else continue;

        }
        scores[key2]=0;

        double sum=0.0;
        for(int i=0;i<scores.length;i++){
            sum+=scores[i];
            System.out.println(scores[i]);
        }

        double number=scores.length-2;
        double averagescore=sum/number;
        return averagescore;
    }

}
